package com.quan.site.api;

import com.quan.commons.core.MyBaseController;
import com.quan.commons.vo.R;
import com.quan.site.commons.vo.SiteNavVo;
import com.quan.site.service.SiteNavService;
import io.swagger.annotations.Api;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;


/**
 * 官网-导航
 *
 * @author yhaoquan
 * @email yhaoquan@163.com
 * @date 2023-07-26 16:47:27
 */
@Slf4j
@Api(tags = "官网-导航")
@RestController
@RequestMapping("/api/sitenav")
public class ApiSiteNavController extends MyBaseController {

    @Autowired
    private SiteNavService service;

    /**
     * 查询出所有分类以及子分类，以树形结构组装起来列表
     *
     * @return
     */
    @GetMapping(value = "/listWithTree")
    public R listTree(SiteNavVo vo) {
        List<SiteNavVo> listWithTree = this.service.listWithTree(vo);
        return R.ok().put("data", listWithTree);
    }

}
